Skip to content

fix: Telegram subject code-wrap, migration backup path cleanup#529

Merged
chrisli30 merged 4 commits into
mainfrom
staging
May 1, 2026
Merged

fix: Telegram subject code-wrap, migration backup path cleanup#529
chrisli30 merged 4 commits into
mainfrom
staging

Conversation

@chrisli30
Copy link
Copy Markdown
Member

  • refactor: derive migration backup path from db_path, drop dead BackupConfig

backup_dir was only consumed by the migration-time backup. The nested
BackupConfig (Enabled/IntervalMinutes/BackupDir) was never read — periodic
backups are not wired up anywhere. Remove the YAML field, the
/tmp/ap-avs-backup default, and the dead struct. The migrator now writes
to <db_path>_backup automatically, keeping backups co-located with the DB
instead of falling back to /tmp.

  • fix: wrap Telegram subject prefix inside block

The Simulation:/Run #N:/Run Node: prefix now renders inside the code
block alongside the workflow name, restoring the pre-rename behavior
where the whole "Simulation: WorkflowName" chunk was code-wrapped.

will-dz added 2 commits April 27, 2026 18:44
…Config

backup_dir was only consumed by the migration-time backup. The nested
BackupConfig (Enabled/IntervalMinutes/BackupDir) was never read — periodic
backups are not wired up anywhere. Remove the YAML field, the
/tmp/ap-avs-backup default, and the dead struct. The migrator now writes
to <db_path>_backup automatically, keeping backups co-located with the DB
instead of falling back to /tmp.
The Simulation:/Run #N:/Run Node: prefix now renders inside the code
block alongside the workflow name, restoring the pre-rename behavior
where the whole "Simulation: WorkflowName" chunk was code-wrapped.
@claude
Copy link
Copy Markdown

claude Bot commented May 1, 2026

Code Review

Overview

This PR contains two independent fixes:

  1. Telegram formatting: Wraps the subject prefix (Simulation:, Run #N:, Run Node:) inside the <code> block alongside the workflow name, fixing the pre-rename rendering behavior.
  2. Config cleanup: Removes the never-implemented BackupConfig struct and derives the migration backup path from db_path instead of a separate config field.

Both changes are well-scoped and easy to follow.


Telegram Subject Code-Wrap (summarizer_format_telegram.go)

Looks correct. Moving sb.WriteString("<code>") before the prefix if block is the minimal, correct fix. The updated comment on formatSubjectWithBoldName accurately describes the new behavior.

The test suite in summarizer_format_test.go is thorough — all affected cases are updated and the unchanged "no prefix" case is implicitly verified by not appearing in the diff.


Migration Backup Path Cleanup (core/config/config.go)

One documentation inconsistency to fix:

The comment added to aggregator.example.yaml:

# Migration backups are written to <db_path>-backup automatically.

uses a hyphen (-backup), but the actual code in config.go uses an underscore:

BackupDir: configRaw.DbPath + "_backup",

These don't match. The comment should read <db_path>_backup to avoid operator confusion.

Removal of BackupConfig is correct. Looking at aggregator.go:253 and backup/backup.go, StartPeriodicBackup is never called from the aggregator startup path — the service is created (backup.NewService) but only used by the migrator for point-in-time migration backups, not periodic ones. Removing BackupConfig.Enabled and BackupConfig.IntervalMinutes doesn't change runtime behavior.

BackupDir on Config is still live — it's passed to backup.NewService at aggregator.go:253, which uses it for migration-time backups. Good that the field was retained; the PR correctly keeps it while changing how the value is derived.

Potential edge case: If DbPath is empty (misconfigured aggregator), BackupDir becomes the bare string "_backup", a relative path. The old /tmp/ap-avs-backup default was an absolute path. This is minor since an empty DbPath would cause the DB itself to fail to open, but it's worth noting.

Breaking YAML change: Removing backup_dir from ConfigRaw means existing aggregator.yaml files with a backup_dir key will silently ignore it. Since the field was effectively dead (its value only reached /tmp/ap-avs-backup by default and periodic backups were never wired up), this is an acceptable cleanup — but consider a log warning on startup if the key is still present in the YAML, or at minimum mention it in the PR/changelog for operators.


Summary

# Severity Location Issue
1 Minor bug config/aggregator.example.yaml Comment says <db_path>-backup but code produces <db_path>_backup (hyphen vs underscore)
2 Nit core/config/config.go Empty DbPath produces relative _backup path; old default was absolute /tmp/ap-avs-backup
3 Info Deployment backup_dir YAML removal is a silent breaking change for any operator config that had it set

The Telegram fix and dead-code removal are clean. Fix the comment inconsistency (issue #1) before merging.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Telegram notification formatting to code-wrap the full subject prefix + workflow name, and simplifies migration-time database backup configuration by deriving the backup directory from db_path and removing unused backup config fields.

Changes:

  • Wrap Telegram subject prefix + workflow name together inside a single <code> block for consistent rendering.
  • Remove unused BackupConfig/YAML fields and derive migration backup path directly from db_path.
  • Update/align tests and config examples with the new formatting and backup behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
core/taskengine/summarizer_format_test.go Updates expected Telegram output strings to match the new <code> wrapping behavior.
core/taskengine/summarizer_format_telegram.go Changes subject formatting to wrap prefix + workflow name within <code>.
core/config/config.go Removes dead backup config structs/fields and derives BackupDir from DbPath.
config/aggregator.example.yaml Removes backup_dir and documents the new derived backup directory behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread config/aggregator.example.yaml Outdated
environment: development

## Aggregator Server Configs
# Migration backups are written to <db_path>-backup automatically.
Comment thread core/config/config.go
Comment on lines 388 to 390
DbPath: configRaw.DbPath,
BackupDir: configRaw.BackupDir,
BackupDir: configRaw.DbPath + "_backup",
JwtSecret: []byte(configRaw.JwtSecret),
will-dz added 2 commits May 1, 2026 16:32
The comment said <db_path>-backup but the code derives <db_path>_backup.
Caught by both Copilot and Claude review on PR #529.
@chrisli30 chrisli30 merged commit 5aea707 into main May 1, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants